<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const origin = {
    name:"admin",
    age:19,
    sex:"男"
  }

  const result = new Proxy(origin, {
    get(obj, attr){
      console.log(`源对象的${attr}属性被访问了`)
      return obj[attr]
    },
    set(obj, attr, val){
      console.log(`源对象的${attr}属性被修改成了${val}`)
      obj[attr] = val;
    }
  });

  console.log(result);

  result.sex

  result.sex = "女"
  result.age = 20

  console.log( result.name )
  console.log( result.age )
  console.log( result.sex )

  origin.msg = "hello";
  result.msg

  result.hello = "world"

  console.log(result.hello)

  
</script>
</html>